<?php
/**
 * Created by PhpStorm.
 * User: mt
 * Date: 2018/6/5
 * Time: 15:10
 */

namespace App\Transformers;
use App\Models\Student;
use League\Fractal\TransformerAbstract;

class StudentTransformer extends TransformerAbstract
{
    public function transform(Student $student)
    {
        return [
            'id' => (int)$student->id,
            'num' => $student->num,
            'name' => $student->name,
            'school_id' => (int)$student->school_id,
            'school_name' => $student->school->name,
        ];
    }

}